// 获取枚举 label
interface Option {
  value: string | number;
  label: string;
  status?: string;
}

// eslint-disable-next-line default-param-last
export const getLabel = (typeList: Option[] = [], type: string | number) => {
  if (!typeList.length || !type) {
    return '-';
  }

  // eslint-disable-next-line
  const item = typeList.find((i) => i.value + '' === type + '');
  if (item && item.label) {
    return item.label;
  }
  return '-';
};

// status 枚举
export const statusOptions: Option[] = [
  { value: 1, label: '正常', status: 'success' },
  { value: 0, label: '停用', status: 'danger' },
  // { value: 2, label: '隐藏', status: 'warning' },
];

// 是否可见
export const visibleOptions: Option[] = [
  { value: 1, label: '显示', status: 'success' },
  { value: 0, label: '隐藏', status: 'warning' },
];

// 文章status
export const articleStatusOptions: Option[] = [
  { value: 0, label: '隐藏', status: 'danger' },
  { value: 1, label: '显示', status: 'success' },
  { value: 2, label: '草稿', status: 'warning' },
];

export const genderOptions: Option[] = [
  { value: 0, label: '未知', status: 'normal' },
  { value: 1, label: '男', status: 'success' },
  { value: 2, label: '女', status: 'processing' },
];
